package luj.tool.jnproxyan.proxy.network.socks.request;

import io.netty.channel.Channel;
import io.netty.handler.codec.http.HttpObject;
import luj.net.api.client.NetConnection;
import luj.net.api.server.ConnectionAcceptInitializer;
import luj.tool.jnproxyan.proxy.network.ssh.tunnel.SshTunnel;

import java.util.Deque;
import java.util.LinkedList;

/**
 * 一个socks通道的相关信息
 */
public class SocksRequest {

  public SocksRequest(Long reqId, long bornTime, ConnectionAcceptInitializer.Connection c2pConn, Channel c2pConnV2) {
    _reqId = reqId;
    _bornTime = bornTime;
    _c2pConn = c2pConn;
    _c2pConnV2 = c2pConnV2;
  }

  public RequestBody getBody() {
    return _body;
  }

  public void setBody(RequestBody body) {
    _body = body;
  }

  public String getStatus() {
    return _status;
  }

  public void setStatus(String status) {
    _status = status;
  }

  public NetConnection getP2sConn() {
    return _p2sConn;
  }

  public void setP2sConn(NetConnection p2sConn) {
    _p2sConn = p2sConn;
  }

  public SshTunnel getP2sConn2() {
    return _p2sConn2;
  }

  public void setP2sConn2(SshTunnel p2sConn2) {
    _p2sConn2 = p2sConn2;
  }

  public Channel getP2sConn3() {
    return _p2sConn3;
  }

  public void setP2sConn3(Channel p2sConn3) {
    _p2sConn3 = p2sConn3;
  }

  public Long getReqId() {
    return _reqId;
  }

  public long getBornTime() {
    return _bornTime;
  }

  public ConnectionAcceptInitializer.Connection getC2pConn() {
    return _c2pConn;
  }

  public Channel getC2pConnV2() {
    return _c2pConnV2;
  }

  public Deque<HttpObject> getWebReqQueue() {
    return _webReqQueue;
  }

  private RequestBody _body;
  private String _status;

  @Deprecated
  private NetConnection _p2sConn;
  private SshTunnel _p2sConn2;
  private Channel _p2sConn3;

  private final Long _reqId;
  private final long _bornTime;

  // 跟浏览器的连接
  @Deprecated
  private final ConnectionAcceptInitializer.Connection _c2pConn;
  private final Channel _c2pConnV2;

  private final Deque<HttpObject> _webReqQueue = new LinkedList<>();
}
